@extends('admin::layouts.master')
@section('title')
    {{$title}}
@endsection
@css(css/goods.css)
@section('tab')
    <form class="layui-form">
    <div class="goods_fax">
        <div class="layui-row">
            <div class="layui-tab layui-tab-brief" lay-filter="filter">
                <div class="layui-tab-content">
                    <div class="layui-form-item">
                        <label for="L_alias" class="layui-form-label">
                            <span class="x-red">*</span>标题</label>
                        <div class="layui-input-block">
                            <input type="text" name="title" placeholder="请输入标题" lay-verify="required" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="L_alias" class="layui-form-label">
                            <span class="x-red">*</span>信息分类</label>
                        <div class="layui-input-block">
                            <select name="pid" class="goods_cate" lay-verify="required">
                                <option value="">请选择分类</option>
                                <option value="1">保养专区</option>
                                <option value="2">检测专区</option>
                                <option value="3">新闻专区</option>
                            </select>
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="L_alias" class="layui-form-label">
                            <span class="x-red">*</span>内容</label>
                        <div class="layui-input-block">
                            {!! baidu_ueditor() !!}
                        </div>
                    </div>

                    <div class="layui-form-item">
                        <label for="L_alias" class="layui-form-label">
                            <span class="x-red">*</span>阅读量</label>
                        <div class="layui-input-block">
                            <input type="number" name="look_num" min="1" placeholder="请输阅读量" autocomplete="off" class="layui-input">
                        </div>
                    </div>

                    {{--<div class="layui-form-item">--}}
                        {{--<label for="L_alias" class="layui-form-label">--}}
                            {{--<span class="x-red">*</span>是否发布</label>--}}
                        {{--<div class="layui-input-block">--}}
                            {{--<select name="issue" lay-verify="required">--}}
                                {{--<option value="">请选择分类</option>--}}
                                {{--<option value="1" >发布</option>--}}
                                {{--<option value="2" >暂不发布</option>--}}
                            {{--</select>--}}
                        {{--</div>--}}
                    {{--</div>--}}

                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button class="layui-btn" lay-filter="add" lay-submit="">提交</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    </form>
@endsection

@section('tab_js')
    @include('admin::goods.this_js')
    <script>
        layui.use(['form', 'layer', 'jquery'], function () {
            $ = layui.jquery;
            var form = layui.form,
                layer = layui.layer;
                var is_submit = false;
                       //监听提交
            form.on('submit(add)', function (data) {
                if( is_submit ){
                    return false;
                }
                is_submit = true;
                $.ajax({
                    url: js_url('admin-discover-store'),
                    type: 'post',
                    data: data.field,
                    dataType: "json",
                    success: function (result) {
                        if (result.state === 0) {
                            layer.msg(result.msg, {time: 600, icon: 6}, function () {
                                // 可以对父窗口进行刷新
                                xadmin.father_reload();
                            });
                        } else {
                            is_submit = false;
                            layer.msg(result.msg, {time: 2000, icon: 5});
                        }
                    }
                });
                return false;
            });


        });
    </script>
@endsection




